<%--
 *  File:    UploadBatchTool.jsp	
 *  @Author: yuelongma 
 *  Date:    2012/09/11
 *
 *  Copyright (C) 2000 - 2008 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  String privilegeCode = "11416";
  String strTableName = "";
  String strModuleName = "PCM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>
<%@ include file="/rpt/ReportURL.inc"%>

<html>
<head>
<title>UploadBatchTool</title>
<PageFlow:CheckPageFlow pageName="p_batchorg"/>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>
<%
Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
Vector provector = (Vector)pageContext.getAttribute("provector");
if(totalsummary == null) totalsummary = new Vector();
if(provector == null) provector = new Vector();
String allflag = (String)pageContext.getAttribute("allflag");
HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
if(UserInfo == null) UserInfo = new HashMap();

HashMap prohash=new HashMap();
for(int i=0;i<provector.size();i++){
	  prohash.put(((HashMap)provector.get(i)).get("numcode"),((HashMap)provector.get(i)).get("productgroupname"));
}
%>
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>

<script language="JavaScript">
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "UploadBatchTool112.jsp?<%= OvalTools.randomURL() %>&globalpccode=112";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_check()
{
    cform.actionname.value = "check";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_confirm(){
    <%--if(nullChecked(document.cform.uploadorgids))
        {
          alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
          return;
        }--%>
	cform.actionname.value = "confirm";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_refuse(){
    <%--if(nullChecked(document.cform.uploadorgids))
        {
          alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
          return;
        }--%>
	cform.actionname.value = "refuse";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_agree(){
    <%--if(nullChecked(document.cform.uploadorgids))
        {
          alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
          return;
        }--%>
	cform.actionname.value = "agree";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_approval(){
    <%--if(nullChecked(document.cform.uploadorgids))
        {
          alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
          return;
        }--%>
	cform.actionname.value = "approval";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_giveup(){
	var flag1 = confirm("<%= message.getMessageDesc("SURE_GIVE_UP")%>");
	if(!flag1){
		return;
	}
	cform.actionname.value = "giveup";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}	

function page_operate(operand)
{
	if(cform.file.value === "" || cform.file.value === null){
		return false;
	}
		  if (operand=="upload")
		  {
		    cform.encoding="multipart/form-data";
		    cform.actionname.value = "upload";
		    cform.target = "_self";
		    cform.submit();
		  }
	  
}
function page_print(){
    //preview
    var url1 = "<%=reportURL%>/servlet/ExcecuteReport/batchorgerrormessage112.sox?__format=xlsx&__folder=/ovalreport&employeeid="+document.cform.userid.value;
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);	

}

function page_confirm1(){
	 /*   if(nullChecked(document.cform.uploadorgids))
	        {
	          alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
	          return;
	        }*/
		cform.actionname.value = "confirm1";
	    cform.target = "_self";
	    isRunning = true;
	    cform.submit();
	}
function page_submit(){
	//cform.pagename.value="p_temporg112";
	cform.actionname.value = "submit";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
</script>
</head>

<body>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_batchorg">
    <input type="hidden" name="actionname">
    <input type="hidden" name="name">
    <input type="hidden" name="codeinsheet" value = "Y"/>
    <input type="hidden" name="type">
    <input type="hidden" name="sheetname" value="batchorg112">
    <input type="hidden" name="flag" value="batchorg112">
    <input type="hidden" name="globalpccode" value="112">
    <input type="hidden" name="__header__Content-disposition" id="outname" value="attachment;filename=DistributorMasterData.xls" />
	<custom:hidden scope="session" name="userinfo" property="userid"></custom:hidden>

<%--  page location   --%>
    <%@ include file="/inc/PageLocation.inc" %>

    <table cellspacing="0" border="0" cellpadding="0">
      <tr>
<%--  search criteria  --%>
      </tr>
      <tr>
        <td>
          <table  border="0" cellspacing="0">
             <tr>
			  <td> 
			  	<%= label.getLabelName("L_Path") %><%= label.getLabelName("L_Colon") %><input type="file" name="file" size="30" >
			    &nbsp;&nbsp;&nbsp;&nbsp;<a onclick="page_operate('upload')"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a>
			    
			  </td>
			 </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td>
        <div style="overflow:auto;width:1320;height:400">
          <table width="2400"  border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
            <tr class="deepblue-left">
              <td class="title_center" ><%= label.getLabelName("L_OrgCode") %></td>
              <td class="title_center" ><%= label.getLabelName("L_OrgName") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_AgreementQuota") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_CreditLimit") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_PurePinProportion") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_AllocateProportion") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_DistributionProportion") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_nature") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_Hospital") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_Pharmacy") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_ThirdTerminal") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_Commercial") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_Sum") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_ReceiptMan") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_RecieverAddress") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_Consignerphone") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_registername") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_CorporatePerson") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_CompanyProperty") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_RegisterDate") %></td><!-- 注册日期 -->
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_RegisterFund") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_BusinessLicenseNo") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_BankName") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_BankAccount") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_VATRegistrationNumber") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_taxno1") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_GSPCertificateNO") %></td>
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_GSPCertificateValidity") %></td><!-- GSP证书有效期 -->
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_RegisteredAddress") %></td>
              <!-- 
              <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_ExInfo") %>1</td>
			  <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_ExInfo") %>2</td>
			  <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_ExInfo") %>3</td>
			  <td class="title_center"  nowrap="nowrap"><%= label.getLabelName("L_ExInfo") %>4</td>
			  <td class="title_center"  wnowrap="nowrap"><%= label.getLabelName("L_ExInfo") %>5</td>
			   -->
              <td class="title_center"  ><%= label.getLabelName("L_ErrorMsg") %> </td>
            </tr>
<%
	int i=0;
	String strClassType="";
	String checkflag = null;
%>
            <%--  the old detail lines  --%>
 <span id="olddetail" >
            <logic:iterate id="onerow" collection="<%= totalsummary %>" indexId="idx" scope="page">
<%
	if(i%2 == 1)
	  {
	    strClassType = "td-listrom";
	  }else{                    
	    strClassType = "none";
	  }
	  i++;
	  
	  HashMap row = (HashMap)pageContext.getAttribute("onerow");
	if(row.get("errormassage") != null){
		strClassType = "need";
		
	}
	checkflag = (String)row.get("ck_flag");
%>
            <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=strClassType%>'" class="<%=strClassType%>">
              <td><custom:write property="orgcode" name="onerow" nbsp="true"/></td>
              <td><custom:write property="orgname" name="onerow" nbsp="true"/></td>
              
              <td><custom:write property="protocolquota" name="onerow" nbsp="true"/></td><!-- 20协议额度-->
              <td><custom:write property="trustquota" name="onerow" nbsp="true"/></td><!-- 20 资信额度-->
              <!-- 纯销、调拨和分销比例之和应为100%！ -->
              <td><custom:write property="salespercent" name="onerow" nbsp="true"/></td><!-- 20 纯销比例  百分比-->
              <td><custom:write property="transferpercent" name="onerow" nbsp="true"/></td><!-- 20 调拨比例 百分比-->
              <td><custom:write property="distributepercent" name="onerow" nbsp="true"/></td><!-- 20 分销比例百分比-->
              <td><custom:write property="biztype" name="onerow" nbsp="true"/></td><!-- 性质ChainHeadquarterType -->
              <!-- 请输入正确的数值！ -->
              <td><custom:write property="bizcoverhospital" name="onerow" nbsp="true"/></td><!-- 20医院 -->
              <td><custom:write property="bizcoverpharmacy" name="onerow" nbsp="true"/></td><!-- 20 药店-->
              <td><custom:write property="bizcoverthirdterminal" name="onerow" nbsp="true"/></td><!-- 20 第三终端-->
              <td><custom:write property="bizcovercorp" name="onerow" nbsp="true"/></td><!-- 20 商业-->
              <td><custom:write property="bizcovertotal" name="onerow" nbsp="true"/></td><!-- 20 合计 bizcoverhospital bizcoverpharmacy bizcoverthirdterminal orgnbizcovercorpame-->
              <td><custom:write property="consigner" name="onerow" nbsp="true"/></td><!-- 20 收货人-->
              <td><custom:write property="consigneraddr" name="onerow" nbsp="true"/></td><!-- 20 收货地址-->
              <td><custom:write property="consignerphone" name="onerow" nbsp="true"/></td><!-- 20收货人电话-->
              <td><custom:write property="registername" name="onerow" nbsp="true"/></td><!-- 20 注册名称-->
              <td><custom:write property="corporateperson" name="onerow" nbsp="true"/></td><!-- 20法人代表 -->
              <td><custom:write property="corptype" name="onerow" nbsp="true"/></td><!-- 20 单位性质-->
              <td><custom:write property="opendate" name="onerow" nbsp="true"/></td><!-- 注册日期 -->
              <!-- 注册资金应该为数字类型 -->
              <td><custom:write property="registerfund" name="onerow" nbsp="true"/></td><!-- 20注册资金 -->
              <td><custom:write property="licenceno" name="onerow" nbsp="true"/></td><!-- 20 营业执照号-->
              <td><custom:write property="accountbank" name="onerow" nbsp="true"/></td><!-- 20 开户行-->
              <td><custom:write property="accountno" name="onerow" nbsp="true"/></td><!-- 20银行账号 -->
              <td><custom:write property="taxno" name="onerow" nbsp="true"/></td><!-- 20 增值税登记号-->
              <td><custom:write property="taxno1" name="onerow" nbsp="true"/></td><!-- 20 纳税人识别号-->
              <td><custom:write property="gspcertificationno" name="onerow" nbsp="true"/></td><!-- GSP证书编号20 -->
              <td><custom:write property="gspvaliditydate" name="onerow" nbsp="true"/></td><!-- GSP证书有效期 -->
              <td><custom:write property="registeraddress" name="onerow" nbsp="true"/></td><!-- 100注册地址-->
              
              <!-- 
              <td><custom:write property="attr101" name="onerow" nbsp="true"/></td>
              <td><custom:write property="attr102" name="onerow" nbsp="true"/></td>
              <td><custom:write property="attr103" name="onerow" nbsp="true"/></td>
              <td><custom:write property="attr104" name="onerow" nbsp="true"/></td>
              <td><custom:write property="attr105" name="onerow" nbsp="true"/></td>
               -->
              <td><custom:write property="errormassage" name="onerow" nbsp="true"/></td>
            </tr>

            </logic:iterate>
</span>
			<tr>
				<td colspan="30" align="left"><%= label.getLabelName("L_TotalData") + label.getLabelName("L_Colon") %><custom:write property="count" name="count" nbsp="true"/></td>
			</tr>

            <%@ include file="/inc/SummaryActionUP_DH.inc" %>
          </table>
          </div>
          <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
		      	<%if (totalsummary.size() > 0){ 
					if(checkflag == null){
				%>
				                <a onclick="page_check();"><custom:button type="1" label="L_CheckContent" imgsrc="new.gif" border="0" style="width:60"/></a>
				                <a onclick="javascript:page_giveup();"><custom:button type="1" label="L_GiveUp" imgsrc="new.gif" border="0" style="width:60"/></a>
				<%}else if(("Y").equals(checkflag)){ %>                
				                <a onclick="javascript:page_print();"><custom:button type="1" label="L_Execcd" imgsrc="new.gif" border="0" style="width:60"/></a>				           
				                <a onclick="javascript:page_confirm();"><custom:button type="1" label="L_Submit1" imgsrc="new.gif" border="0" style="width:60"/></a>
				                <a onclick="javascript:page_giveup();"><custom:button type="1" label="L_GiveUp" imgsrc="new.gif" border="0" style="width:60"/></a>
<!--				                <a onclick="javascript:page_confirm1();"><custom:button type="1" label="L_Submit1" imgsrc="new.gif" border="0" style="width:60"/></a>  				                -->
                                <!--  
								<a onclick="javascript:page_submit();"><custom:button type="1" label="L_Submit_batch" imgsrc="new.gif" border="0" style="width:60" /></a>
			                    -->
				<%}else if(("N").equals(checkflag)){ %>
				                <a onclick="javascript:page_print();"><custom:button type="1" label="L_Execcd" imgsrc="new.gif" border="0" style="width:60"/></a>				           
				                
				                <a onclick="javascript:page_giveup();"><custom:button type="1" label="L_GiveUp" imgsrc="new.gif" border="0" style="width:60"/></a>									                
				<%}}%>  
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
</form>
</table>
</body>
</html>